package com.example.ojcommon.enums;

import lombok.Getter;

/**
 * 题目结果枚举
 */
@Getter
public enum SubmitReturnEnum {
    ACCEPTED("ACCEPT", 1),
    ANSWER_WRONG("ANSWER_WRONG", 2),
    COMPILE_WRONG("COMPILE_WRONG", 3),
    RUNNING_WRONG("RUNNING_WRONG", 4),
    TIMEOUT("TIMEOUT", 5),
    MEMORY_OUT("MEMORY_OUT", 6);

    private final String text;

    private final Integer value;

    SubmitReturnEnum(String text, Integer value) {
        this.text = text;
        this.value = value;
    }

    public static SubmitReturnEnum valueOf(Integer value) {
        if (value == null) {
            return null;
        }
        for (SubmitReturnEnum submitReturnEnum : SubmitReturnEnum.values()) {
            if (submitReturnEnum.getValue().equals(value)) {
                return submitReturnEnum;
            }
        }
        return null;
    }
}
